<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //实例化构造函数生成实例对象
    console.log(Promise);
    //promise的状态
    const p=new Promise((resolve,reject)=>{
      //promise有三种状态，一开始是pending(未完成)，执行resolve，变成fulfilled，已成功，执行reject，变成rejected，以失败
      // resolve({name:'a'})
      reject('报错')
    })
    p.then((data)=>{
      console.log(data);
    },(data)=>{
      console.log(data);
    })

  </script>
</body>
</html>
